package com.lovely3x.jobservice.executors.extensions.version;

import android.os.Parcel;

import com.lovely3x.jobservice.task.Task;

/**
 * 版本检查任务
 * Created by lovely3x on 16-2-18.
 */
public class VersionCheckTask implements Task {

    long what;

    long commitTime;

    String taskType;

    long delay;

    /**
     * 版本检查地址
     */
    String versionCheckUrl;

    public VersionCheckTask(long what, long commitTime, String taskType, long delay, String versionCheckUrl) {
        this.what = what;
        this.commitTime = commitTime;
        this.taskType = taskType;
        this.delay = delay;
        this.versionCheckUrl = versionCheckUrl;
    }

    public String getVersionCheckUrl() {
        return versionCheckUrl;
    }

    public void setVersionCheckUrl(String versionCheckUrl) {
        this.versionCheckUrl = versionCheckUrl;
    }

    @Override
    public long getWhat() {
        return what;
    }

    @Override
    public void setWhat(long what) {
        this.what = what;
    }

    @Override
    public long getCommitTime() {
        return commitTime;
    }

    @Override
    public void setCommitTime(long commitTime) {
        this.commitTime = commitTime;
    }

    @Override
    public String getTaskType() {
        return taskType;
    }

    @Override
    public void setTaskType(String taskType) {
        this.taskType = taskType;
    }

    @Override
    public long getDelay() {
        return delay;
    }

    @Override
    public void setDelay(long delay) {
        this.delay = delay;
    }

    public VersionCheckTask() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.what);
        dest.writeLong(this.commitTime);
        dest.writeString(this.taskType);
        dest.writeLong(this.delay);
        dest.writeString(this.versionCheckUrl);
    }

    protected VersionCheckTask(Parcel in) {
        this.what = in.readLong();
        this.commitTime = in.readLong();
        this.taskType = in.readString();
        this.delay = in.readLong();
        this.versionCheckUrl = in.readString();
    }

    public static final Creator<VersionCheckTask> CREATOR = new Creator<VersionCheckTask>() {
        public VersionCheckTask createFromParcel(Parcel source) {
            return new VersionCheckTask(source);
        }

        public VersionCheckTask[] newArray(int size) {
            return new VersionCheckTask[size];
        }
    };
}
